<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Settingminiappsnotice extends Model
{
    protected $table = 'setting_miniapps_notice';
    protected $primaryKey = 'id';

    public static function insertSettingMiniappsNotice($users_id,$links_lists_minapps_id,$type,$status,$message)
    {
        return self::insert(["users_id"=>$users_id,"links_lists_minapps_id"=>$links_lists_minapps_id,"type"=>$type,"status"=>$status,"message"=>$message,"created_at"=>time()]);
    }

    public static function getSettingMiniappsNotice()
    {
        return self::select('users.nike','links_lists_minapps.name','setting_miniapps_notice.*')
                ->leftjoin('users', 'users.id', '=', 'setting_miniapps_notice.users_id')
                ->leftjoin('links_lists_minapps', 'links_lists_minapps.id', '=', 'setting_miniapps_notice.links_lists_minapps_id')
                ->orderBy("setting_miniapps_notice.id","DESC")
                ->orderBy('setting_miniapps_notice.links_lists_minapps_id', 'DESC')
                ->paginate(25);
    }
}
